Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Stop putting a time caveat on access tokens #1656

Merged
merged 2 commits into from
Nov 30, 2016
Merged

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Nov 28, 2016

The 'time' caveat on the access tokens was something of a lie, since we weren't
enforcing it; more pertinently its presence stops us ever adding useful time
caveats.

Let's move in the right direction by not lying in our caveats.

@richvdh richvdh force-pushed the rav/remove_time_caveat branch from 94d4790 to d32a300 Compare November 28, 2016 10:15
The 'time' caveat on the access tokens was something of a lie, since we weren't
enforcing it; more pertinently its presence stops us ever adding useful time
caveats.

Let's move in the right direction by not lying in our caveats.
@richvdh richvdh force-pushed the rav/remove_time_caveat branch from d32a300 to 1c4f05d Compare November 29, 2016 16:49
@@ -810,6 +810,10 @@ def validate_macaroon(self, macaroon, type_string, verify_expiry, user_id):
else:
v.satisfy_general(lambda c: c.startswith("time < "))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well remove the verify_expiry config option while you are at it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and put a comment explaining why we aren't ever going to check the "time < " caveats.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But leave the v.satisfy_general(lambda c: c.startswith("time < ")) so that existing tokens will still work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except you can't remove the verify_expiry option because it's used in validate_short_term_login_token_and_get_user_id

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you probably want to add a comment to explain what's going on.

Update comments in verify_macaroon
@NegativeMjark
Copy link
Contributor

LGTM

@richvdh
Copy link
Member Author

richvdh commented Nov 30, 2016

test fails seem unrelated.

@richvdh richvdh merged commit 321fe5c into develop Nov 30, 2016
@richvdh richvdh deleted the rav/remove_time_caveat branch November 30, 2016 16:53
richvdh added a commit that referenced this pull request Jul 29, 2019
The `expire_access_token` didn't do what it sounded like it should do. What it
actually did was make Synapse enforce the 'time' caveat on macaroons used as
access tokens, but since our access token macaroons never contained such a
caveat, it was always a no-op.

(The code to add 'time' caveats was removed back in v0.18.5, in #1656)
richvdh added a commit that referenced this pull request Jul 30, 2019
The `expire_access_token` didn't do what it sounded like it should do. What it
actually did was make Synapse enforce the 'time' caveat on macaroons used as
access tokens, but since our access token macaroons never contained such a
caveat, it was always a no-op.

(The code to add 'time' caveats was removed back in v0.18.5, in #1656)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants